﻿function trim(input) {
    var lre = /^\s*/;
    var rre = /\s*$/;
    input = input.replace(lre, "");
    input = input.replace(rre, "");
    return input;
} //fun

//保留几位小数  X：要处理的数据   point:（整型）保留几位小数
function changeDecimal(x, point) {
    var f_x = parseFloat(x);
    if (isNaN(f_x)) {
        alert('参数错误！请检查您的输入');
        return false;
    }
    var pointNumber = 100;
    if (point == 1) { pointNumber = 10; }
    else if (point == 2) { pointNumber = 100; }
    else if (point == 3) { pointNumber = 1000; }
    else if (point == 4) { pointNumber = 10000; }
    var f_x = Math.round(x * pointNumber) / pointNumber;
    return f_x;
}